//
//  GoodsView.m
//  HAODE
//
//  Created by panquanReabam.com on 15/9/24.
//  Copyright (c) 2015年 reabam.com. All rights reserved.
//

#import "GoodsView.h"

@implementation GoodsView


- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        

        _headImageFull = [[UIImageView alloc]init];
        [_headImageFull.layer setCornerRadius:0];
        [_headImageFull.layer setBorderWidth:0];
        [_headImageFull.layer setMasksToBounds:YES];
        CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
        CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){ 0.93, 0.93, 0.93, 0.93 });
        [_headImageFull.layer setBorderColor:colorref2];//边框颜色
       
        _headImageFull.frame = CGRectMake(15, 17.5, 82, 82);
        [self addSubview:_headImageFull];
        
        _itemName = [[UILabel alloc]init];
        _itemName.numberOfLines=0;
        _itemName.textColor=qianheiColor;
        _itemName.font=[UIFont systemFontOfSize:14];
        [self addSubview:_itemName];
        
        
        _itemType = [[UILabel alloc]init];
        _itemType.frame = CGRectMake(_headImageFull.right+12, 65, ScreenWidth-120, 13);
        _itemType.font=[UIFont systemFontOfSize:13];
        _itemType.textColor=shenhuiColor;
        [self addSubview:_itemType];

        _quantity = [[UILabel alloc]init];
        _quantity.font=[UIFont systemFontOfSize:12];
        _quantity.textColor=shenhuiColor;
        [self addSubview:_quantity];

        
        _dealPrice = [[UILabel alloc]init];
        _dealPrice.font=[UIFont systemFontOfSize:16];
        _dealPrice.textColor=shenhuiColor;
        [self addSubview:_dealPrice];

        _diffQuantity = [[UILabel alloc]init];
        _diffQuantity.font=[UIFont systemFontOfSize:12];
        _diffQuantity.textColor=shenhuiColor;
        [self addSubview:_diffQuantity];
        _deliveryQty = [[UILabel alloc]init];
        _deliveryQty.frame = CGRectMake(ScreenWidth-250, _dealPrice.bottom+5, 230,12);
        _deliveryQty.font=[UIFont systemFontOfSize:12];
        _deliveryQty.textAlignment=NSTextAlignmentRight;
        _deliveryQty.textColor=zhonghuiColor;
        [self addSubview:_deliveryQty];

        
        
//        UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(10, 120-0.40, ScreenWidth-20, 0.40)];
//        label.backgroundColor=qianhuiColor;
//        [self addSubview:label];
      
        [self setViewAutoLayout];
    }
    return self;
}
-(void)setViewAutoLayout
{
    [self.quantity mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(110) ;
        make.height.equalTo(@13);
        make.top.equalTo(self.mas_top).with.offset(82);
    }];
    [self.dealPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.quantity.mas_right).with.offset(15) ;
        make.height.equalTo(@16);
        make.top.equalTo(self.mas_top).with.offset(80);
    }];
    [self.diffQuantity mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.dealPrice.mas_right).with.offset(15) ;
        make.height.equalTo(@13);
        make.top.equalTo(self.mas_top).with.offset(82);
    }];

    [self.itemName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(110) ;
        make.right.equalTo(self.mas_right).with.offset(-10);
        make.height.equalTo(@34);
        make.top.equalTo(self.mas_top).with.offset(15.5);
    }];
}
@end
